<script setup>
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
function goBack() {
    router.back()
}

const newFormRef = ref()
const newForm = reactive({
    name: '',
    status: '1',
})
function submitAction() {
    newFormRef.value.validate((valid, fields) => {
        if (valid) {
            console.log('submit!')
        } else {
            console.log('error submit!', fields)
        }
    })
}
</script>
<template>
    <el-page-header @back="goBack">
        <template #content>
            <span>新增 </span>
        </template>
    </el-page-header>
    <div class="white-box d-flex-1 mt-10">
        <el-row :gutter="50">
            <el-col :span="16">
                <el-form
                    ref="newFormRef"
                    :model="newForm"
                    label-width="80px"
                    label-position="top"
                >
                    <div class="main-hd">基本信息</div>
                    <el-row :gutter="20">
                        <el-col :span="12">
                            <el-form-item
                                label="名称"
                                prop="name"
                                :rules="[
                                    {
                                        required: true,
                                        message: '名称不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.name"
                                    placeholder="请输入"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="代理视频流" prop="status">
                                <el-radio-group v-model="newForm.status">
                                    <el-radio-button label="1">
                                        启用
                                    </el-radio-button>
                                    <el-radio-button label="0">
                                        禁用
                                    </el-radio-button>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                    </el-row>

                    <div class="main-hd">信令服务配置</div>
                    <el-row :gutter="20">
                        <el-col :span="12">
                            <el-form-item
                                label="集群节点"
                                prop="jd"
                                :rules="[
                                    {
                                        required: true,
                                        message: '集群节点不能为空',
                                    },
                                ]"
                            >
                                <el-select
                                    v-model="newForm.jd"
                                    placeholder="请选择"
                                    class="full"
                                >
                                    <el-option label="集群节点1" value="1" />
                                    <el-option label="集群节点2" value="2" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item
                                label="信令名称"
                                prop="name1"
                                :rules="[
                                    {
                                        required: true,
                                        message: '信令名称不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.name1"
                                    placeholder="请输入"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item
                                label="上级SIP ID"
                                prop="sipid"
                                :rules="[
                                    {
                                        required: true,
                                        message: '上级SIP ID不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.sipid"
                                    placeholder="请输入"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item
                                label="上级SIP域"
                                prop="sipyu"
                                :rules="[
                                    {
                                        required: true,
                                        message: '上级SIP域不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.name"
                                    placeholder="请输入"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item
                                label="上级SIP地址"
                                prop="sipaddress"
                                :rules="[
                                    {
                                        required: true,
                                        message: '上级SIP地址不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.sipaddress"
                                    placeholder="请输入IP地址"
                                    class="d-flex-2 mr-10"
                                />
                                <el-input
                                    v-model="newForm.port"
                                    placeholder="请输入端口号"
                                    class="d-flex-1"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item
                                label="本地SIP ID"
                                prop="sipid1"
                                :rules="[
                                    {
                                        required: true,
                                        message: '本地SIP ID不能为空',
                                    },
                                ]"
                            >
                                <el-input
                                    v-model="newForm.sipid1"
                                    placeholder="请输入"
                                />
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item>
                        <el-button type="primary" @click="submitAction">
                            保存
                        </el-button>
                    </el-form-item>
                </el-form>
            </el-col>
            <el-col :span="8" class="article">
                <div class="fw-b">1、概述</div>
                <p>
                    概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述
                </p>
                <div class="fw-b">2、概述</div>
                <p>概述概述概述概述概述概述</p>
                <div class="fw-b">3、概述</div>
                <p>概述概述概述概述概述概述</p>
                <div class="fw-b">4、概述</div>
                <p>概述概述概述概述概述概述</p>
            </el-col>
        </el-row>
    </div>
</template>
<style lang="scss" scoped></style>
